home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / dominos.c < prev    next >
C/C++ Source or Header  |  2000-04-04  |  6KB  |  202 lines

  1. /***************************************************************************
  2.  
  3. Atari Dominos Driver
  4.  
  5. Memory Map:
  6.         0000-03FF        RAM
  7.         0400-07FF        DISPLAY RAM
  8.         0800-0BFF    R    SWITCH
  9.         0C00-0FFF    R    SYNC
  10.         0C00-0C0F    W    ATTRACT
  11.         0C10-0C1F    W    TUMBLE
  12.         0C30-0C3F    W    LAMP2
  13.         0C40-0C4F    W    LAMP1
  14.         3000-37FF        Program ROM1
  15.         3800-3FFF        Program ROM2
  16.        (F800-FFFF)        Program ROM2 - only needed for the 6502 vectors
  17.  
  18. If you have any questions about how this driver works, don't hesitate to
  19. ask.  - Mike Balfour (mab22@po.cwru.edu)
  20. ***************************************************************************/
  21.  
  22. #include "driver.h"
  23. #include "vidhrdw/generic.h"
  24.  
  25. /* machine/dominos.c */
  26. READ_HANDLER( dominos_port_r );
  27. READ_HANDLER( dominos_sync_r );
  28. WRITE_HANDLER( dominos_attract_w );
  29. WRITE_HANDLER( dominos_tumble_w );
  30. WRITE_HANDLER( dominos_lamp2_w );
  31. WRITE_HANDLER( dominos_lamp1_w );
  32.  
  33. /* vidhrdw/dominos.c */
  34. extern void dominos_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  35.  
  36. static struct MemoryReadAddress readmem[] =
  37. {
  38.     { 0x0000, 0x03ff, MRA_RAM }, /* RAM */
  39.     { 0x0400, 0x07ff, MRA_RAM }, /* RAM */
  40.     { 0x0800, 0x083f, dominos_port_r }, /* SWITCH */
  41.     { 0x0840, 0x087f, input_port_3_r }, /* SWITCH */
  42.     { 0x0900, 0x093f, dominos_port_r }, /* SWITCH */
  43.     { 0x0940, 0x097f, input_port_3_r }, /* SWITCH */
  44.     { 0x0a00, 0x0a3f, dominos_port_r }, /* SWITCH */
  45.     { 0x0a40, 0x0a7f, input_port_3_r }, /* SWITCH */
  46.     { 0x0b00, 0x0b3f, dominos_port_r }, /* SWITCH */
  47.     { 0x0b40, 0x0b7f, input_port_3_r }, /* SWITCH */
  48.     { 0x0c00, 0x0fff, dominos_sync_r }, /* SYNC */
  49.     { 0x3000, 0x3fff, MRA_ROM }, /* ROM1-ROM2 */
  50.     { 0xfff0, 0xffff, MRA_ROM }, /* ROM2 for 6502 vectors */
  51.     { -1 }    /* end of table */
  52. };
  53.  
  54. static struct MemoryWriteAddress writemem[] =
  55. {
  56.     { 0x0000, 0x03ff, MWA_RAM },
  57.     { 0x0400, 0x07ff, videoram_w, &videoram, &videoram_size }, /* DISPLAY */
  58.     { 0x0c00, 0x0c0f, dominos_attract_w }, /* ATTRACT */
  59.     { 0x0c10, 0x0c1f, dominos_tumble_w }, /* TUMBLE */
  60.     { 0x0c30, 0x0c3f, dominos_lamp2_w }, /* LAMP2 */
  61.     { 0x0c40, 0x0c4f, dominos_lamp1_w }, /* LAMP1 */
  62.     { 0x0c80, 0x0cff, MWA_NOP }, /* TIMER RESET */
  63.     { 0x3000, 0x3fff, MWA_ROM }, /* ROM1-ROM2 */
  64.     { -1 }    /* end of table */
  65. };
  66.  
  67. INPUT_PORTS_START( dominos )
  68.         PORT_START        /* DSW - fake port, gets mapped to Dominos ports */
  69.         PORT_DIPNAME( 0x03, 0x01, "Points To Win" )
  70.         PORT_DIPSETTING(    0x03, "6" )
  71.         PORT_DIPSETTING(    0x02, "5" )
  72.         PORT_DIPSETTING(    0x01, "4" )
  73.         PORT_DIPSETTING(    0x00, "3" )
  74.         PORT_DIPNAME( 0x0C, 0x08, "Cost" )
  75.         PORT_DIPSETTING(    0x0C, "2 players/coin" )
  76.         PORT_DIPSETTING(    0x08, "1 coin/player" )
  77.         PORT_DIPSETTING(    0x04, "2 coins/player" )
  78.         PORT_DIPSETTING(    0x00, "2 coins/player" ) /* not a typo */
  79.  
  80.         PORT_START        /* IN0 - fake port, gets mapped to Dominos ports */
  81.         PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_4WAY | IPF_PLAYER2)
  82.         PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_4WAY | IPF_PLAYER2)
  83.         PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_4WAY | IPF_PLAYER2)
  84.         PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_4WAY | IPF_PLAYER2)
  85.         PORT_BIT (0xF0, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  86.  
  87.         PORT_START        /* IN1 - fake port, gets mapped to Dominos ports */
  88.         PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_4WAY )
  89.         PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_4WAY )
  90.         PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_4WAY )
  91.         PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_4WAY )
  92.         PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_START1 )
  93.         PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_START2 )
  94.         PORT_BITX(0x40, IP_ACTIVE_LOW, IPT_SERVICE | IPF_TOGGLE, "Self Test", KEYCODE_F2, IP_JOY_NONE )
  95.  
  96.         PORT_START        /* IN2 */
  97.         PORT_BIT ( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
  98.         PORT_BIT ( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
  99.  
  100.         PORT_START        /* IN3 */
  101.         PORT_BIT ( 0x0F, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  102.         PORT_BIT ( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN )    /* ATTRACT */
  103.         PORT_BIT ( 0x20, IP_ACTIVE_HIGH, IPT_VBLANK )    /* VRESET */
  104.         PORT_BIT ( 0x40, IP_ACTIVE_HIGH, IPT_VBLANK )    /* VBLANK* */
  105.         PORT_BIT ( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )    /* Alternating signal? */
  106.  
  107. INPUT_PORTS_END
  108.  
  109.  
  110. static struct GfxLayout charlayout =
  111. {
  112.     8,8,    /* 8*8 characters */
  113.     64,     /* 64 characters */
  114.     1,        /* 1 bit per pixel */
  115.     { 0 },          /* no separation in 1 bpp */
  116.     { 4, 5, 6, 7, 0x200*8 + 4, 0x200*8 + 5, 0x200*8 + 6, 0x200*8 + 7 },
  117.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
  118.     8*8 /* every char takes 8 consecutive bytes */
  119. };
  120.  
  121. static struct GfxDecodeInfo gfxdecodeinfo[] =
  122. {
  123.     { REGION_GFX1, 0, &charlayout, 0x00, 0x02 }, /* offset into colors, # of colors */
  124.     { -1 } /* end of array */
  125. };
  126.  
  127. static unsigned char palette[] =
  128. {
  129.     0x80,0x80,0x80, /* LT GREY */
  130.     0x00,0x00,0x00, /* BLACK */
  131.     0xff,0xff,0xff, /* WHITE */
  132.     0x55,0x55,0x55, /* DK GREY */
  133. };
  134. static unsigned short colortable[] =
  135. {
  136.     0x00, 0x01,
  137.     0x00, 0x02
  138. };
  139. static void init_palette(unsigned char *game_palette, unsigned short *game_colortable,const unsigned char *color_prom)
  140. {
  141.     memcpy(game_palette,palette,sizeof(palette));
  142.     memcpy(game_colortable,colortable,sizeof(colortable));
  143. }
  144.  
  145.  
  146. static struct MachineDriver machine_driver_dominos =
  147. {
  148.     /* basic machine hardware */
  149.     {
  150.         {
  151.             CPU_M6502,
  152.             750000,        /* 750 Khz ???? */
  153.             readmem,writemem,0,0,
  154.             interrupt,1
  155.         }
  156.     },
  157.     60, DEFAULT_REAL_60HZ_VBLANK_DURATION,    /* frames per second, vblank duration */
  158.     1,    /* single CPU, no need for interleaving */
  159.     0,
  160.  
  161.     /* video hardware */
  162.     32*8, 28*8, { 0*8, 32*8-1, 0*8, 28*8-1 },
  163.     gfxdecodeinfo,
  164.     sizeof(palette) / sizeof(palette[0]) / 3, sizeof(colortable) / sizeof(colortable[0]),
  165.     init_palette,
  166.  
  167.     VIDEO_TYPE_RASTER,
  168.     0,
  169.     generic_vh_start,
  170.     generic_vh_stop,
  171.     dominos_vh_screenrefresh,
  172.  
  173.     /* sound hardware */
  174.     0,0,0,0
  175.  
  176. };
  177.  
  178.  
  179.  
  180.  
  181.  
  182. /***************************************************************************
  183.  
  184.   Game ROMs
  185.  
  186. ***************************************************************************/
  187.  
  188. ROM_START( dominos )
  189.     ROM_REGION( 0x10000, REGION_CPU1 ) /* 64k for code */
  190.     ROM_LOAD( "7352-02.d1",   0x3000, 0x0800, 0x738b4413 )
  191.     ROM_LOAD( "7438-02.e1",   0x3800, 0x0800, 0xc84e54e2 )
  192.     ROM_RELOAD(               0xf800, 0x0800 )
  193.  
  194.     ROM_REGION( 0x800, REGION_GFX1 | REGIONFLAG_DISPOSE )
  195.     ROM_LOAD( "7439-01.p4",   0x0000, 0x0200, 0x4f42fdd6 )
  196.     ROM_LOAD( "7440-01.r4",   0x0200, 0x0200, 0x957dd8df )
  197. ROM_END
  198.  
  199.  
  200.  
  201. GAMEX( 1977, dominos, 0, dominos, dominos, 0, ROT0, "Atari", "Dominos", GAME_NO_SOUND )
  202.